<?php
/**
 * Search a Customer -
 *
 * @author Xavier VILAIN
 *
 */

use Fox\SearchEngine;
use Fox\Html\AnchorObject;
use Fox\Generator;
use Nawa\Messages;
use Fox\Msg;
use Fox\Dao\SqlFragment;
use Nawa\Customer;
use Fox\Html\Button;

$searchScreen = new Fox\Html\Screen\Search\Basic("search",new Customer());
$searchScreen->searchEngineOptions(SearchEngine::MODE_LIKE);
$searchScreen->filter(array(new SqlFragment("type = ?",array(Customer::TYPE_EMPLOYEE))));
$searchScreen->screen()->mainTitle("<div class=\"page-title\">".Msg(Messages::BUNDLE,Messages::TITLE_SEARCH_INVESTIGATORS)."</div>");
$searchScreen->screen()->toolbar()->add(new Button("create",Generator::url("contacts","create")));
$grid = Xview::instance()->component("contacts","result");
$grid->setFieldAttr(array("name1","name2"),"setAnchor",
new AnchorObject("?mod=contacts&act=update",array(
					'customerid' => Fox\Generator::useAttribute())
));
$searchScreen->grid($grid);

echo $searchScreen->render();